#include <iostream>
using namespace std;
#define maxn 101
char suqare[maxn][maxn];
int mask[maxn][maxn];
char keyword[] = "yizhong";
int dx[8] = {0, 0, -1, 1, 1, -1, -1, 1};
int dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};
int n;
void dfs(int x, int y)
{
    if (suqare[x][y] == keyword[0])
    { //找到keyword的头,开始寻找
        int i, j, k, tx, ty;
        for (i = 0; i < 8; ++i) //第i种方向的搜寻
        {
            tx = x, ty = y;
            for (j = 0; j < 7; ++j) //沿着方向i走7步
            {
                if (!(tx >= 0 && tx < n && ty >= 0 && ty < n))
                    break;
                if (suqare[tx][ty] != keyword[j])
                    break;
                tx += dx[i], ty += dy[i];
            }
            if (j == 7)
            { //找到了字符串
                tx = x, ty = y;
                for (k = 0; k < 7; ++k)
                {
                    mask[tx][ty] = 1;
                    tx += dx[i], ty += dy[i];
                }
            }
        }
    }
}
int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> suqare[i];
    }
    for (int x = 0; x < n; ++x)
        for (int y = 0; y < n; ++y)
            dfs(x, y);
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            if (mask[i][j] == 0)
                suqare[i][j] = '*';
    for (int i = 0; i < n; ++i)
        cout << suqare[i] << endl;
    return 0;
}